package Scrap;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class demo19_removingZeros {

	public static void main(String[] args) {

		int[][] array2 = null;
		int row = 0;
		int column = 0;
		removeZeroRowsColumns(array2, row, column);
	}

	private static void removeZeroRowsColumns(int[][] array2, int row,
			int column) {
		int row1 = 0;
		int column1 = 0;
		int sum1 = 0;
		int sum2 = 0;
		List<Integer> rowList = new ArrayList<Integer>();
		List<Integer> colList = new ArrayList<Integer>();

		while (row1 < row) { // while loop ends
			column1 = 0;
			sum1 = 0;
			while (column1 < column) {

				sum1 = sum1 + array2[row1][column1];
				// System.out.println("row :: "+row1 +"column ::"+column1 );
				System.out.println(sum1);
				column1++;
			}

			if (sum1 == 0) {
				rowList.add(row1);
	//			System.out.println("rowList" + rowList);    // all the zero elements are added to the rowlist 
		
		}
			row1++;
				} // while loop ends

		column1 = 0;
		while (column1 < column) {

			row1 = 0;
			sum2 = 0;
			while (row1 < row) {

				sum2 = sum2 + array2[row1][column1];

				row1++;
			}

			if (sum2 == 0) {

				colList.add(column1);
				System.out.println("colList" + colList);

			}

			column1++;
		}
	print(rowList);
	print(colList);
		// displayFinalArray(array, rowList, colList, row, column);

	}

	private static void print(List<Integer> rowList) {
		
		
		Iterator iter=rowList.iterator();
		while(iter.hasNext()){
			
	System.out.println(iter.next());		
			
		}
		
	}

}
